package com.cssy.xxkj.basic.dao.impl;

import com.cssy.xxkj.basic.dao.BasicSeriesDAO;
import com.cssy.xxkj.basic.entity.BasicSeriesDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-24
 */
public class BasicSeriesDAOImpl extends SqlMapClientDaoSupport implements BasicSeriesDAO {

    /**
     * 插入数据
     * @param basicSeriesDO
     * @return 插入数据的主键
     */
    public String insertBasicSeriesDO(BasicSeriesDO basicSeriesDO) {
        Object id = getSqlMapClientTemplate().insert("BasicSeries.insert", basicSeriesDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param basicSeriesDO
     * @return 查出的记录数
     */
    public Integer countBasicSeriesDOByExample(BasicSeriesDO basicSeriesDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("BasicSeries.countByDOExample", basicSeriesDO);
        return count;
    }

    /**
     * 更新记录
     * @param basicSeriesDO
     * @return 受影响的行数
     */
    public Integer updateBasicSeriesDO(BasicSeriesDO basicSeriesDO) {
        int result = getSqlMapClientTemplate().update("BasicSeries.update", basicSeriesDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param basicSeriesDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<BasicSeriesDO> findListByExample(BasicSeriesDO basicSeriesDO) {
        List<BasicSeriesDO> list = getSqlMapClientTemplate().queryForList("BasicSeries.findListByDO", basicSeriesDO);
        return list;
    }

    /**
     * 根据主键获取basicSeriesDO
     * @param id
     * @return basicSeriesDO
     */
    public BasicSeriesDO findBasicSeriesDOByPrimaryKey(String id) {
        BasicSeriesDO basicSeriesDO = (BasicSeriesDO) getSqlMapClientTemplate().queryForObject("BasicSeries.findByPrimaryKey", id);
        return basicSeriesDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteBasicSeriesDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("BasicSeries.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<BasicSeriesDO> find(SearchConditions scs) throws DataAccessException {
		List<BasicSeriesDO> list = getSqlMapClientTemplate().queryForList("BasicSeries_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("BasicSeries_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("BasicSeries_ex.deleteBizRemoved", id);
        return rows;
	}

}